package com.iwhalecloud.bss.kite.cucc.service.attr.handler;

import com.iwhalecloud.bss.kite.common.constant.KeyConsts;
import com.iwhalecloud.bss.kite.common.util.KiteStringUtils;
import com.iwhalecloud.bss.kite.cucc.service.attr.LocalAttrHelper;
import com.iwhalecloud.bss.kite.cucc.service.util.ProdCateUtil;
import com.iwhalecloud.bss.kite.manager.api.IOperateSceneInstService;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import com.iwhalecloud.bss.kite.service.attr.handler.AbstractAttrHandler;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Objects;

public class EnterpriseSelfPurchaseAttrHandler extends AbstractAttrHandler<KiteInst, AttrData> {
    @Autowired
    private IOperateSceneInstService operateSceneInstService;

    @Override
    public void after(KiteAttr attr, KiteInst inst, AttrData data) {
        super.after(attr, inst, data);
        //产品变更 需置灰
        if (KiteStringUtils.isEqual(data.getServiceOfferId(), "2826")
            && KiteStringUtils.equals(inst.getSpecId(), ProdCateUtil.getMainMemberProdId(ProdCateUtil.GIFT_DZ5G_PROD))) {
            attr.setIsEdit(KeyConsts.IFTRUE_F);
            operateSceneInstService
                .setAttr(data.getSceneInstId(), inst.getInstType(), inst.getInstId(), attr);
        }
    }
}
